package com.example.api;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.cloud.openfeign.SpringQueryMap;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * <b><code>UserProvider</code></b>
 * <p>
 * Description
 * <p>
 * <b>Create Time:</b> 2023/2/17 16:17.
 *
 * @author qd.yt
 * @version 0.0.1
 * @since demo-openfeign v0.0.1
 */
@FeignClient(name = "demo-provider",path = "/user-provider/user")
@RestController
@Service
public interface UserProvider {

    @RequestMapping(value = "/getUser", method = RequestMethod.GET)
    String getUser(@RequestParam("id") Integer id);

    @RequestMapping(value = "/getUser1", method = RequestMethod.GET)
    String getUser(@RequestParam("id") Integer id,@RequestParam(value = "name",required = false)  String name);

    @RequestMapping(value = "/getUser2", method = RequestMethod.GET)
    String getUser2(@RequestParam("id") Integer id,@RequestParam("name")  String name,@RequestParam("age") String age);


    @RequestMapping(value = "/saveOrder", method = RequestMethod.POST)
    String saveOrder(@RequestBody Order order);

    @RequestMapping(value = "/updateOrder", method = RequestMethod.GET)//POST也可以，@RequestBody替换SpringQueryMap也可以
    String updateOrder(@RequestBody  Order order, @RequestParam("id")   String id);

    @RequestMapping(value = "/sendMap", method = RequestMethod.POST)//@RequestParam 也可以用
    String sendMap(@RequestBody Map<String, Object> commandPack);

    @RequestMapping(value = "/sendList", method = RequestMethod.POST)
    String sendList(@RequestParam("id")String id,@RequestBody List<Order> orders);

    @RequestMapping(value = "/sendListMore", method = RequestMethod.POST)
    String sendListMore(@RequestParam("id")String id,@RequestParam("uid")String uid,@RequestBody List<Order> orders,@SpringQueryMap  Order order);

    @RequestMapping(value = "/sendListMap", method = RequestMethod.GET)
    String sendListMap(@RequestParam Map<String, Object> commandPack,@RequestBody List<Order> orders);

    @RequestMapping(value = "/sendEnumList", method = RequestMethod.GET)
    String sendEnumList(@RequestParam("sexType") SexType sexType,@RequestParam("id") String id,@RequestParam("idsList") List<String> idsList);
}
